FROM alpine:3.20.1
MAINTAINER dhc <dhc@cnscoo.cn>
ARG VERSION="20.2"
ARG FILE="ZenTaoPMS-20.2.0-php8.1.zip"
ARG SERVER_NAME="127.0.0.1"
ENV SERVER_NAME="${SERVER_NAME}"
COPY entrypoint.sh entrypoint.sh
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.cloud.tencent.com/g' /etc/apk/repositories && \
  apk update && apk upgrade && \
  apk add tzdata apache2 php php-apache2 php-pdo php-pdo_mysql php-json php-iconv php-session php-curl php-mbstring php-mysqli php-mysqlnd php-gd php-ctype wget unzip && \
  cp /usr/share/zoneinfo/Asia/Chongqing /etc/localtime && \
  echo "Asia/Chongqing" > /etc/timezone && \
  sed -i 's|#ServerName .*|ServerName ${SERVER_NAME}|' /etc/apache2/httpd.conf && \
  sed -i 's|/var/www/localhost/htdocs|/var/www/zentaopms/www|g' /etc/apache2/httpd.conf && \
  sed -i "s|;date.timezone =.*|date.timezone = Asia/Chongqing|" /etc/php83/php.ini && \
  sed -i "s|;session.save_path = \"/tmp\"|session.save_path = \"/tmp\"|" /etc/php83/php.ini && \
  wget https://dl.cnezsoft.com/zentao/${VERSION}/${FILE} && \
  unzip ${FILE} -d /tmp/ && rm -f ${FILE} && \
  apk del wget unzip && \
  chmod +x ./entrypoint.sh
VOLUME /var/www/zentaopms
EXPOSE 80
ENTRYPOINT ["./entrypoint.sh"]